package com.yykj.order.center.server.exception;

public class ErrorCodeException extends RuntimeException {

	public ErrorCodeException(ErrorCode errorCode) {
		super(errorCode.getMsg());
		this.errorCode = errorCode;
		this.code = errorCode.getCode();
		this.msg = errorCode.getMsg();
	}

	private ErrorCode errorCode;
	private Integer code;
    private String msg;

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public String getMsg() {
        return msg;
    }

    public ErrorCode getErrorCode() {
		return errorCode;
	}

	public void setErrorCode(ErrorCode errorCode) {
		this.errorCode = errorCode;
	}

	public ErrorCodeException msg(String msg) {
		this.errorCode.setMsg(msg);
		return this;
	}

	public ErrorCodeException code(int code) {
		this.errorCode.setCode(code);
		return this;
	}

	public Integer getCode() {
		return code;
	}

	public void setCode(Integer code) {
		this.code = code;
	}
}